package cn.schoolwow.workflow.module.definition.query.service;

import cn.schoolwow.quickdao.domain.DAO;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import cn.schoolwow.workflow.entity.WorkFlowDefinition;

import java.util.List;

public class GetWorkFlowDefinitionListServiceFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        DAO dao = flowContext.checkInstanceData(DAO.class);

        dao.addRecordString("查询工作流定义列表");
        List<WorkFlowDefinition> workFlowDefinitionList = dao.query(WorkFlowDefinition.class)
                .execute()
                .getList();
        flowContext.putTemporaryData("workFlowDefinitionList", workFlowDefinitionList);
    }

    @Override
    public String name() {
        return "查询工作流定义列表服务流程";
    }
}
